<?
function myReadFile($fn)
{
	$fp = fopen($fn,"r");
	$res = fread($fp, filesize($fn));
	fclose($fp);
	return $res;
}
function IsNews($fileName) 
{
	$allowedExtensions = array("html", "HTML","txt");
	return in_array(GetExt($fileName), $allowedExtensions);

}
function listing ($url,$mode) 
	{
		$folders=array();
		$files=array();
		
		if (is_dir($url)) 
			if ($dir = opendir($url)) 
			{
				while ($file = readdir($dir)) 
					if ($file != "." && $file != "..") 
					{

						if(is_dir($url."/".$file)) 
						{
							$folders[] = $file;
						}
						else 
						{
							if(IsNews($file))
								$files[] = $file;
						}
					}
				closedir($dir);
			}
		if($mode == 1) {return $folders;}
		if($mode == 0) {return $files;}
		
	}
	
	$dir = 'data\\ru_content\\news\\';
	$news = listing ($dir,0);
	for($i=0;$i<count($news);$i++)
	{
		echo '<p align=justify>';
		echo nl2br(myReadFile($dir.$news[$i]));
		echo '</p>';
	}
	
?>